#include <iostream>
#include <list>
using namespace std;

int main() {
	int ia[] = { 0, 1, 2, 3, 5, 8, 13, 21, 55, 89};
	list<int> ilist(ia, ia+10);
	
	list<int>::iterator it;
	list<int>::iterator tmp;
	
	for(it = ilist.begin(); it != ilist.end();){
		tmp = ++it;
		--it;
		if(*it % 2 != 0)
			ilist.erase(it);
		else 
			++it;
		it = tmp;
	}
	
	
	for(it = ilist.begin(); it != ilist.end(); ++it)
		cout << *it << " ";
}
